UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'unJCG4jepJ+uyvwGEme1r+bOBwxrIM17gDz+Z6C/H30=' 
WHERE 
  key_id = 'f687edc26f65e1332c1e160288e799d9ad6f5dd313f6282c585f0c430763e2b8' 
  AND (
    token = 'unJCG4jepJ+uyvwGEme1r+bOBwxrIM17gDz+Z6C/H30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043