UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0C1T8exw59Wu0nR9zMS9g2trrsTYDb64qww6zrEWCM8='
WHERE
key_id = '5719b7956d883fabdfc9b4378b40030006f7659d416f6d9f5a43f2002767ab89'
AND (
token = '0C1T8exw59Wu0nR9zMS9g2trrsTYDb64qww6zrEWCM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)