UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U0Hdm29tqbrV44rq9kYcSXmtO30mxBoLR1gRRC22IAA='
WHERE
key_id = '216fc4b6b152961a1ede5374693d20722b00b71ee77ad04aba5dc609682975aa'
AND (
token = 'U0Hdm29tqbrV44rq9kYcSXmtO30mxBoLR1gRRC22IAA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)