UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BGyeAoP3BqQQqT5ZUMdGfB8AFI/Ic5CUemD5KwAS3VQ=' 
WHERE 
  key_id = 'bedb0bc9edcdfa6fec83992edf575b02d89ecb3b0332b917a3f9a8617a561a46' 
  AND (
    token = 'BGyeAoP3BqQQqT5ZUMdGfB8AFI/Ic5CUemD5KwAS3VQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020