UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lmwtfrv6d3yyZlbkZqn5cCEQtF71c8iubec/fJYLSkk=' 
WHERE 
  key_id = '102354a332aaaf03831da3c42d58ff46ac4493f708f3b92d20efa40244bc0c31' 
  AND (
    token = 'Lmwtfrv6d3yyZlbkZqn5cCEQtF71c8iubec/fJYLSkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050