UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UiZ1Vn/KEpdBVwj0OUURt8I95y8BdxlHrPffpdXWiDE=' 
WHERE 
  key_id = '4d1f5b496d0e732634873329c09261175bcc104df8ce7b62b6907620a29aecd8' 
  AND (
    token = 'UiZ1Vn/KEpdBVwj0OUURt8I95y8BdxlHrPffpdXWiDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032