UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rId0B2PCHidTDn20X4FOcCxwJN0exW1eugyhLhUCpw0='
WHERE
key_id = '1a215979145b8fdaaeceeee9a68d15a129e68d8545011a0444c650fb2750fcb4'
AND (
token = 'rId0B2PCHidTDn20X4FOcCxwJN0exW1eugyhLhUCpw0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)