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