UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eXHNZs4xL9kRy940ENtuKh4PXKChmx6GqTq31SUSLIo=' 
WHERE 
  key_id = '2a68f4f8ff34df1a527697c3f74678085bb10145e26f192696a532c7b2602c94' 
  AND (
    token = 'eXHNZs4xL9kRy940ENtuKh4PXKChmx6GqTq31SUSLIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031