UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '87OHcAcbnJtELKJfK8RESPV+V7cYwEiYrUB2gwUhHQU='
WHERE
key_id = '431fe4cee4470cd179e2fa181230174a055dd0d1367d0143cc5b39698e8ea394'
AND (
token = '87OHcAcbnJtELKJfK8RESPV+V7cYwEiYrUB2gwUhHQU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)