UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SQ8JaPjD16p5M/D3FdkioAoqeTX205VTcfEfbkN4X7s='
WHERE
key_id = '6fd5995965d2a785eaf4aef95b37c1919254b91f6da50cf820cba56ee5896a23'
AND (
token = 'SQ8JaPjD16p5M/D3FdkioAoqeTX205VTcfEfbkN4X7s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)