UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'czrr7I53TWIAvKDacoGMAyXWjeP0vaadFakWz2s8Dhc=' 
WHERE 
  key_id = '8bf61a86dbd3b70b16f39c4848f74d8f29ccd384a6e43474558d9cdcb9330c0e' 
  AND (
    token = 'czrr7I53TWIAvKDacoGMAyXWjeP0vaadFakWz2s8Dhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026