UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hQuu5Iih4s8AEEhUlVbFv6W4fToHjzS+hGJbpfnTsj8='
WHERE
key_id = 'def778ef2970eae6b8787897405f0be7797fc60a154a483960d248b3bccd9c3a'
AND (
token = 'hQuu5Iih4s8AEEhUlVbFv6W4fToHjzS+hGJbpfnTsj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)