UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cNeXwIUKsmfikrbE++Kwi96ek8Zqa4+7WIbKUr2QaWY=' 
WHERE 
  key_id = '773188b93fc94a2e1441285e9afeccc33574d65e7f123dfd2b69c487d4830fcd' 
  AND (
    token = 'cNeXwIUKsmfikrbE++Kwi96ek8Zqa4+7WIbKUr2QaWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029