UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nl9Vp/rtf3k+jqATljBPmTra8F+cn2vumhLOOY/97+k='
WHERE
key_id = '17154c312ea29ddb0c523fa816a4e011ca962b924ada2d8933f0f83263c8fb44'
AND (
token = 'nl9Vp/rtf3k+jqATljBPmTra8F+cn2vumhLOOY/97+k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)