UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8DlVVtkAvZg0W0J3PW1uCIn71DnJkKfWjYsYg5dNBOs='
WHERE
key_id = '58ba45fa16202a80204f26e25dd5285eab70e168757a5057664c2449ffc5c8ae'
AND (
token = '8DlVVtkAvZg0W0J3PW1uCIn71DnJkKfWjYsYg5dNBOs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)