UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E4c4PHavOnbM+mhw1FmJZiOmz9g6EW348+TtJx7T6RQ='
WHERE
key_id = 'dda67a9bbd5c64eeaef85222938cbeaf78e015e93c6c87c876c678be6d8d89be'
AND (
token = 'E4c4PHavOnbM+mhw1FmJZiOmz9g6EW348+TtJx7T6RQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)