UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XFyhfictwoNN9sHfdCrwk3Jz+6jK4lxVEaM4KpARWh8=' 
WHERE 
  key_id = '0fbb9e8f73960aa0931b35c6d3b43c1b7700ee81a2764bca94cbf0008b0ed53e' 
  AND (
    token = 'XFyhfictwoNN9sHfdCrwk3Jz+6jK4lxVEaM4KpARWh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025