UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8twvtDqGVHiTLhznr+r/znkKYlMdMd0L+1PdKv6+dEE='
WHERE
key_id = '74c3db8e4ed6812af79148e12c688852190c86c2d590e017ccfe688fd1146f99'
AND (
token = '8twvtDqGVHiTLhznr+r/znkKYlMdMd0L+1PdKv6+dEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)