UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/fQRF3X91GPMk6+V3e36RocwSaJLDLdl0xKAuleY4h8=' 
WHERE 
  key_id = '65879850911a96e6dc50e04ec8cd5a2214166ff1211ba5f8b5c20f6d137c6f80' 
  AND (
    token = '/fQRF3X91GPMk6+V3e36RocwSaJLDLdl0xKAuleY4h8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035