UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JRH8uLOBm11EUewvCKbV7Pvc8UiwWdCM2ZcjsJvCrcE=' 
WHERE 
  key_id = '91c20f17f825ebeb1ce086485760cf65dbec1f13a4580db5b93480a12d88408d' 
  AND (
    token = 'JRH8uLOBm11EUewvCKbV7Pvc8UiwWdCM2ZcjsJvCrcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028