UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2VS38rx1jxGLpZgN6kDdpWEWmCKwqKfPMPBYQvBwf7Y=' 
WHERE 
  key_id = 'c4a7e857693e84978c38046e063980782489fc118bcdf5da42c9f5e9a8c95e4e' 
  AND (
    token = '2VS38rx1jxGLpZgN6kDdpWEWmCKwqKfPMPBYQvBwf7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027