UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BwmvJhsJNgBezLKdzQtQD1xgyhnnDM4JZD2VV6CgHqY='
WHERE
key_id = 'e8682891c89d45220d9dc9894f8e51d0b3e00f7cf6a44332a3a32eba1044ad2f'
AND (
token = 'BwmvJhsJNgBezLKdzQtQD1xgyhnnDM4JZD2VV6CgHqY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)