UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oCr+2pAcquMb7WuqSxRw7QXlXYX0C56eRgc1ybgyZ4A=' 
WHERE 
  key_id = '9991a668ab0b85fd7d6d1185c0efd8909c2a8be397d4805a204efb2da9db570b' 
  AND (
    token = 'oCr+2pAcquMb7WuqSxRw7QXlXYX0C56eRgc1ybgyZ4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015