UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lz9EAsOJZ+2rzhh3NIknX2mfU4oEpdN/pxmAdV7NOQ8=' 
WHERE 
  key_id = '2c95b24bc2146b157aa3df399c36d7e50b7b8eb5993e96909a8e81cfb10e96b0' 
  AND (
    token = 'lz9EAsOJZ+2rzhh3NIknX2mfU4oEpdN/pxmAdV7NOQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045