UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8X17mPzguu3ZYCSizPz4wgQ/kx1dkXBleZcY8veb1HE=' 
WHERE 
  key_id = '41ea1584d1ca6e2a3d329229933d33d4942926c12c94af495e50b63751880e71' 
  AND (
    token = '8X17mPzguu3ZYCSizPz4wgQ/kx1dkXBleZcY8veb1HE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029