UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IALSNQBtvI3SUHFDsJLB0SWdcTNttU3isGpfhypwadE=' 
WHERE 
  key_id = 'f85818fc6a1768ce056d5b94249510e53325bc6c3a8bd01f916f486931ef2b96' 
  AND (
    token = 'IALSNQBtvI3SUHFDsJLB0SWdcTNttU3isGpfhypwadE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018