UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J6vVlEYmxWci0bn9YVqJZrs1CxY7s3bYurWU+p2nCpk='
WHERE
key_id = '0156d3d290ff2ca41ac7090341a7d3e2ebe99205f760391a63ada7938499d7a2'
AND (
token = 'J6vVlEYmxWci0bn9YVqJZrs1CxY7s3bYurWU+p2nCpk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)