UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7E3yGTqcX9XeoZATPZN5BGJT0BCqCbxNPW4heGAyMps='
WHERE
key_id = '58f1ff820df1e56424a0f022a003a088b3f43c0e402b31c353bfcbd4628fba5f'
AND (
token = '7E3yGTqcX9XeoZATPZN5BGJT0BCqCbxNPW4heGAyMps='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)