UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'USZ9f8KoIffENIWe/yIlfM2gmyg+YjyhZUCiOZbY3PU='
WHERE
key_id = 'bcb1be21697d2183b9a3c608e9113db6459e22ba52f52e65509c754e46cdd1c7'
AND (
token = 'USZ9f8KoIffENIWe/yIlfM2gmyg+YjyhZUCiOZbY3PU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)