UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9yKfdNqKXbSARAUSJcoNFCTlC1YetIyaeengxjuxsc0=' 
WHERE 
  key_id = '54a5f1e88f73b4a29943fb80197454932289ef853157ba12b852060741d800ca' 
  AND (
    token = '9yKfdNqKXbSARAUSJcoNFCTlC1YetIyaeengxjuxsc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035