UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kmTQnWldk64UZLnyaWx1/wB2ojO6bXaM76E9rpqKOkk=' 
WHERE 
  key_id = '5ac879268588da6d52189d1d9de1c944215672129344ba41413b92ec9c14debf' 
  AND (
    token = 'kmTQnWldk64UZLnyaWx1/wB2ojO6bXaM76E9rpqKOkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038