UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9iAXk9w84r6b/KldVSaOsakdV4iVA3lf+N7tnkNvLCU=' 
WHERE 
  key_id = '9bdc2026b939c3df74630d8392b77332fb03d7a633e7f59df0647214a2b64d87' 
  AND (
    token = '9iAXk9w84r6b/KldVSaOsakdV4iVA3lf+N7tnkNvLCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034