UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OWC7FqXH7eXKr0xKKWfxAxLGuV4pi+I+3AEEmG3zfII=' 
WHERE 
  key_id = '3515a6640c6a4783bfe03027be343696911e0559f0717b7e1f70607d2718300b' 
  AND (
    token = 'OWC7FqXH7eXKr0xKKWfxAxLGuV4pi+I+3AEEmG3zfII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020