UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D2DJTb4wq7yZt3OkQ0rspO+dplwSyQ9u1Jqo40pvPg4='
WHERE
key_id = '7e0c6832e7ea43bcde469fd325471a3b7413f091f884dfb11385ae52677aa9ec'
AND (
token = 'D2DJTb4wq7yZt3OkQ0rspO+dplwSyQ9u1Jqo40pvPg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)