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

Query time 0.00044