UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S6W1P5Nf2FKnnIkXXcJ0QlT+WlYb1N9/zUFnu3glAqM=' 
WHERE 
  key_id = '008a607f0acb765a7d97d7597f2655a7af276dd6a5d543bbb0dc1bb82e7afafd' 
  AND (
    token = 'S6W1P5Nf2FKnnIkXXcJ0QlT+WlYb1N9/zUFnu3glAqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023