UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J8yd0yx9aY456t/WIwA8DypiYFJmZ1NlbT2yzZYtRvE=' 
WHERE 
  key_id = '0b1c16933cebbc644d92294e4780f0d7c5b44870e85e4912c3edb33e1f4ce3d2' 
  AND (
    token = 'J8yd0yx9aY456t/WIwA8DypiYFJmZ1NlbT2yzZYtRvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052