UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aC9wqwhvjdgPDcHSpVApSdKm4/DkZkPCRsgs4zJT+tE=' 
WHERE 
  key_id = 'dcb0335746a23c15c25d1c36ee55a3b2fde50035df1b5583eb9add3f291bdeef' 
  AND (
    token = 'aC9wqwhvjdgPDcHSpVApSdKm4/DkZkPCRsgs4zJT+tE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034