UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'os3rS9wVYV1M3lI8Eu1DNOfcQkfDp8v3zxzfwkd/chA=' 
WHERE 
  key_id = '39e478bb0f1f306fe5bb236256e5809ffcb05c27c4dcf985b10eb0c0e16a80bf' 
  AND (
    token = 'os3rS9wVYV1M3lI8Eu1DNOfcQkfDp8v3zxzfwkd/chA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016