UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UuXw+76HpHsdNxgwmrz2V8iBWyxkxRkhO3thcR8LAbc=' 
WHERE 
  key_id = '77f80414b11ac5c53fb0a0f306785cf479c50487c7b311f2f13249f8f673931a' 
  AND (
    token = 'UuXw+76HpHsdNxgwmrz2V8iBWyxkxRkhO3thcR8LAbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031