UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JEofpEJI0DkxHc767twwDPtYY9oEjjq7LGt7ffopo44=' 
WHERE 
  key_id = '14856e70315eaf671cd83325713fa67fd3a747537c7481fdbb92bb450825ba0c' 
  AND (
    token = 'JEofpEJI0DkxHc767twwDPtYY9oEjjq7LGt7ffopo44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032