UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'okc0Ucwcq7MKXLk5IpM9HCzBg+KooSA0lnklnDOsmrQ='
WHERE
key_id = 'b55a20e81b977aeefd650d1998860986aa58160cf705f080812b6cf4c13e77fe'
AND (
token = 'okc0Ucwcq7MKXLk5IpM9HCzBg+KooSA0lnklnDOsmrQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)