UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mYiAKQ99FKSeLoH6o102Wa4g6oHKf+xTNR72+S+IQPw='
WHERE
key_id = '31a38db6053d8503a6e33dc34a70a64c2c9abe95bde1d30df3c92157e32f0246'
AND (
token = 'mYiAKQ99FKSeLoH6o102Wa4g6oHKf+xTNR72+S+IQPw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)