UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VtPmQsuREz7G0ISfLocSs8AF0qJDfatMYDUXtAue7P0='
WHERE
key_id = '20b97ece457885c8309cd9577f96c1f2710217c52c1fb3049ff92ddf9dacfa03'
AND (
token = 'VtPmQsuREz7G0ISfLocSs8AF0qJDfatMYDUXtAue7P0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)