UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lfcGdKsfXEanwU0ijLrhsC37MMuDL8cGmkJZN7rwq6A='
WHERE
key_id = '539f7de2fd87eca85677517b827154d612c554563aed3f060bf66f994d789676'
AND (
token = 'lfcGdKsfXEanwU0ijLrhsC37MMuDL8cGmkJZN7rwq6A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)