UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'blhbE5R0ecuFEEiozj/s4kwF1vQh1Ah+I64a03E2U10='
WHERE
key_id = '5c385084355dc92475a627f0e96f57fdc65b52b504b9946ed2d581bc121571cb'
AND (
token = 'blhbE5R0ecuFEEiozj/s4kwF1vQh1Ah+I64a03E2U10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)