UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5YkYryCWwTxjpYI/sh/6vPjEOkDIHklFE2R8UbOSgYw='
WHERE
key_id = '24b5ebc573d26d9cfac8c3e05aca285a5fcfaad8889361269c2c13e40644ff3a'
AND (
token = '5YkYryCWwTxjpYI/sh/6vPjEOkDIHklFE2R8UbOSgYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)