UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ii+sWxMkGvPE2BcVKHXRRY1ktukXhHeLf75taGdmKh0=' 
WHERE 
  key_id = '068e6e45a88068c4935ed3155de86fe32e4ad180d5b6379967b8f362d6eed245' 
  AND (
    token = 'Ii+sWxMkGvPE2BcVKHXRRY1ktukXhHeLf75taGdmKh0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050