UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kIvw9OZ6j+8tLQL9ao3dfPabZtD2ZNy0QTlXyznamjw='
WHERE
key_id = 'dda092671c7f242a2877119622e00c25f75c00fffb5ea89036e5f327b0bf79a6'
AND (
token = 'kIvw9OZ6j+8tLQL9ao3dfPabZtD2ZNy0QTlXyznamjw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)