UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tjUyLuw6lWHRyZaqNdEkzblL6OLWPgJaubjlO2cFZPA='
WHERE
key_id = '03d7f0321526d0f27f8153263aaf5dbd97dc76379f1170a8b465e54ea08b4a2f'
AND (
token = 'tjUyLuw6lWHRyZaqNdEkzblL6OLWPgJaubjlO2cFZPA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)