UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BhWG9Iz67g5gdsKPObcnWrNkeFb02TC37YpqdUi0Yzk='
WHERE
key_id = '4fdc8c72ee508a5635a00811195b95b1ffe2529b1c678f4ef58c289c470a114b'
AND (
token = 'BhWG9Iz67g5gdsKPObcnWrNkeFb02TC37YpqdUi0Yzk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)