UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jYjWkRe40jPNejWUQQRJoF+yIuqNGv76I7AC+PuVEN8=' 
WHERE 
  key_id = '58054c1a966c90db2691d8f795169441bf37efb9c04272dab5f1905fbb2cade4' 
  AND (
    token = 'jYjWkRe40jPNejWUQQRJoF+yIuqNGv76I7AC+PuVEN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027