UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J1euhjV/wFeigZI2QAWdsRXjPaT7ZF89PtJXzEue1gk='
WHERE
key_id = 'c2a12b45234187a3814bed7b331d9b5a62d2e23c8166cbbc7b54043b95b38c32'
AND (
token = 'J1euhjV/wFeigZI2QAWdsRXjPaT7ZF89PtJXzEue1gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)