UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BuxjY8RchcvgQArl+cm6/fIEhdKCC5MvY+/cQIWyUBc=' 
WHERE 
  key_id = '0ab94b424c30f16097a75b6cc497b6d790145e85889847c17172014b50788798' 
  AND (
    token = 'BuxjY8RchcvgQArl+cm6/fIEhdKCC5MvY+/cQIWyUBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024